<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }
        .box {
            width: 500px;
            height: 400px;
            margin: 10px auto;
            border: 1px solid #ccc;
            text-align: center;
        }
        .box .inn {
            height: 30px;
            line-height: 30px;
        }
        .bottom {
            width: 200px;
            height: 200px;
            background-color: black;
            color: #fff;
            margin: 15px auto;
            font-size: 14px;
        }
    </style>
</head>
<body>
    <div class="box">
        <div class="inn">
            属性名：<input type="text" value="background">
        </div>
        <div class="inn">
            属性值：<input type="text" class="inp" value="green">
        </div>
        <div class="inn">
            <button class="trues">确定</button>
            <button class="chong">重置</button>
        </div>
        <div class="bottom">在上方输入框输入"属性名"及"属性值",点击确定按钮查看效果</div>
    </div>
</body>
</html>
<script>
var trues = document.querySelector('.trues')
var chong = document.querySelector('.chong')
var buto = document.querySelector('.bottom')
var inp = document.querySelector('.inp')
trues.onclick = function () {
    buto.style.backgroundColor = `${inp.value}`
}
</script>